import request from '@/api/search_request.js'
import request2 from '@/api/search_request1.js'
import store from '@/store'

export function searchThink(data){
	return request({
		//url: `/api/search?keyWord=${data}`,
		url: `/api/search?keyWord=${data}`,
		//data:{'keyWord':data}
		method: 'get',
	})
}

export function searchCity(){
	return request({
		url: `/api/common/cityAll`,
		method: 'get'
	})
}
export function cityList(){
	return request({
		url: `/api/common/cityList`,
		method: 'get'
	})
}

export function searchNav(data){
	return request({
		url: `/api/common/selectSet?type=${data}`,
		method: 'post'
	})
}

export function getHistoryList(){
	return request({
		url: `/api/search/history?token=${store.state.doc.token}`,
		method: 'post'
	})
}

export function getHotRecommend(){
	return request({
		url: `/api/search/hot`,
		method: 'get'
	})
}

//	0：未知 1:医院 2:科室 3:专家 4:疾病
export function postKeyWord(datas){
	return request({
		//url: `/api/search/result?token=${store.state.doc.token}&keyWord=${data.keyWord}&type=${data.type}`,
		url: `/api/search/result`,
		data:{'token':store.state.doc.token,...datas},
		method: 'post',
	})
}

//首页医院列表
export function indexhosp(data){
	return request({
		url: `/api/hos/list`,
		data:{'token':store.state.doc.token,...data},
		method: 'post',
	})
}

//搜索结果类型(医院)
export function resultHos(datas){
	return request({
		url: `/api/search/resultHos`,
		data:{'token':store.state.doc.token,...datas},
		method: 'post',
	})
}
export function resultDept(datas){
	return request({
		url: `/api/search/resultDept`,
		data:{'token':store.state.doc.token,...datas},
		method: 'post',
	})
}
export function resultDocto(datas){
	return request({
		url: `/api/search/resultDoctor`,
		data:{'token':store.state.doc.token,...datas},
		method: 'post',
	})
}

export function delHistory(){
	return request({
		url: `/api/search/delAll?token=${store.state.doc.token}`,
		method: 'post'
	})
}

//按疾病-热门疾病
export function byDiseaseHot(){ 
	return request({
		url: `/api/search/byDiseaseHot`,
		method: 'get'
	})
}


//按科室-热门科室
export function byDeptHot(){ 
	return request({
		url: `/api/search/byDeptHot`,
		method: 'get'
	})
}

//按疾病-（左侧列表）
export function positionList(){ 
	return request({
		url: `/api/search/positionList`,
		method: 'get'
	})
}

//按疾病（右侧列表，由左侧id查询得到）
export function diseaseByPostiont(data){ 
	return request({
		url: `/api/search/diseaseByPostion?positionId=${data}`,
		method: 'post'
	})
}


//全量科室（包括左侧列表）
export function byDeptClassifyTree(){ 
	return request({
		url: `/api/search/byDeptClassifyTree`,
		method: 'post'
	})
}

//户关注添加
export function UserSubscribe(data){ 
	return request({
		url: `/user/collect/add?token=${store.state.doc.token}&contentId=${data.contentId}&content=${data.content}&contentType=${data.contentType}`,
		method: 'post',
	})
}
//用户关注-是否关注
export function IsUserSubscribe(data){ 
	return request({
		url: `/user/collect/isCollect?token=${store.state.doc.token}&contentId=${data.contentId}`,
		method: 'post',
	})
}

//用户关注-取消关注
export function UserUnSubscribe(data){ 
	return request({
		url: `/user/collect/del?token=${store.state.doc.token}&id=${data.id}`,
		method: 'post',
	})
}





//李源接口
//获取医院信息（医院主页）
export function getHospitalInfo(id){ 
	return request2({
		url: `/api/hos/getHospitalInfo?hospitalId=${id}`,  //模拟数据
		method: 'get'
	})
}
//获取分院
export function getHospitalBranchs(id){ 
	return request2({
		url: `/api/hos/getHospitalBranchs?hospitalId=${id}`,  //模拟数据
		method: 'get'
	})
}
//获取一级科室列表
export function getHospitalBigDepartments(id){ 
	return request2({
		url: `/api/dept/getHospitalBigDepartments?hospitalId=${id}`,  //模拟数据
		method: 'get'
	})
}
//获取二级科室列表
export function getChildDepartments(depId){ 
	return request2({
		url: `/api/dept/getChildDepartments?departmentId=${depId}`,  //模拟数据
		method: 'get'
	})
}

//获取科室详细信息
export function getDepartmentInfo(departmentId){ 
	return request2({
		url: `/api/dept/getDepartmentInfo?departmentId=${departmentId}`,  
		method: 'get'
	})
}	
//获取(李源科室)日期列表---科室主页 头部
export function getDepartmentIndexDates(id){ 
	return request2({
		url: `/api/dept/getDepartmentIndexDates?childdeptId=${id}`,  
		method: 'get'
	})
}
//获取科室下医生列表
export function getDoctorsByDay(params){ 
	return request2({
		url: `/api/doctor/getDoctorsByDay?childdeptId=${params.childdeptId}&day=${params.time}&pageNumber=${params.pageNumber}`,  
		method: 'get'
	})
}

export function getDoctorsByDayALL(params){ 
	return request2({
		url: `/api/doctor/getDoctorsByDay?childdeptId=${params.childdeptId}&pageNumber=${params.pageNumber}`,  
		method: 'get'
	})
}

//获取医院概述信息
export function getHospitalOverview(id){ 
	return request2({
		url: `/api/hos/getHospitalOverview?hospitalId=${id}`,  
		method: 'get'
	})
}

//获取医生评分 预约量 关注量
export function getDoctorFocus({doctorId,doctorCode}){ 
	return request2({
		url: `/api/doctor/getDoctorAttach?doctorId=${doctorId}&doctorCode=${doctorCode}`,  
		method: 'get'
	})
}


